"""
购物车管理页面
"""
from selenium.webdriver.common.by import By

from base.base_page import BasePage


class GoodsCartPage(BasePage):
    """
    结算商品页面
    """

    def __init__(self):
        super().__init__(driver_type='web')
        # 全选按钮定位
        self.check_all_btn = By.CLASS_NAME, 'checkall'
        # 去结算按键
        self.go_to_settlement_btn = By.CLASS_NAME, 'paytotal'

    def go_to_submit_order_page(self):
        """
        购物车结算页面
        """
        # 确认全选
        element = self.find_element_method(self.check_all_btn)
        # 判断未勾选时，全选
        if not element.is_selected():
            self.click_element(element)
        self.click_element(self.find_element_method(self.go_to_settlement_btn))